#ifndef CREATURE_H_INCLUDED
#define CREATURE_H_INCLUDED

#include "Common.h"

class Item;

enum CREATURE_STATUS {
        CS_NOTUSE = 0x0,
        CS_INUSE  = 0x1,
        CS_ALIVE  = 0x2,
};



class Creature
{
public:
        Rect &getRect()
        {
            return m_position;
        }
        Rect &getPosition()
        {
            return m_position;
        }
        Live &getLive()
        {
            return m_live;
        }
        bool dead() const
        {
            return m_live.dead();
        }
private:
        Live            m_live;
        Rect            m_position;
};

class Monster : public Creature
{
public:
        class MonsterIndexOutRange {};
        Monster(ushort);

        static Monster *New(ushort type);
        const char *name() const ;
        void Action();
        void draw(BITMAP *surface);
        void used() {}
        void unused() {}

private:
        uint            m_id;
        ushort          m_mtype;
        int             m_frame;
        int             m_oldframe;

        static uint    s_id;
};

class Player : public Creature
{
public:
        Player ();
        void draw(BITMAP *surface);

        Item *getInven(short row, short col);
        Item *getBody(short pos);
        void attack(ushort mid, ushort moffset);
        bool addItem(Item *item);
        bool _dropItem(Item *item);
        bool throwItem(Item *item);
        bool destroyItem(Item *item);
        bool use(Item *item);
        bool equip(Item *item);
        bool unequip(Item *item);

private:
        GifAnimation *m_spirte;

        Item   *m_items[INV_ROW*INV_COL];
        Item   *m_body[BODY_MAX];
};

/*
struct MonsterRecord {
        uint m_id;
        uint m_offset;
        Rect m_postion;
};

struct ItemRecord {
        Item *m_item;
        Rect  m_postion;
        short m_mapx, m_mapy;
};

class SeenObj
{
public:
        MonsterRecord *SeenMonster(short x, short y);
        ItemRecord *SeenItem(short x, short y);
        void add(Monster *monster, const Rect &pos);
        void add(Item *item, const Rect &pos, short x, short y);
        void remove(ItemRecord &m);
        void clear();
        void Action();

private:
        vector<MonsterRecord> m_seens;
        vector<ItemRecord>    m_items;
};
*/
class Npc : public Creature
{
public:
        Npc();
        ~Npc();
        void addSellItem(Item *);
        void bindToSellGui();

private:
        vector<Item *> m_sells;
};

#endif // CREATURE_H_INCLUDED
